<?
include("includes/config.inc.php");
include("includes/auth.lib.php");
include("includes/image.class.php");
include("includes/upload.class.php");
$uname = $_POST['username'];
$passw = $_POST['password'];
$logout = $_GET['logout'];
$module = $_GET['module'];
if($module == "")
  $module = $_POST['module'];
if ($logout==1)  {
    if (auth_logout())
     header("Location:index.html");
    else
     header("Location:index.html");
    } else  {
if (isset($uname) && isset($passw))  {
   login($uname,$passw);
   } else {
   $cookietest = $_GET['cookietest'];
//controlla se il browser accetta i cookie
if (!check_cookie($cookietest))  {
   echo "<div align=center>Spiacenti, il tuo browser non accetta i cookie.<br>";
   echo "<a href=index.htm>Ritorna</div>";
   }  else  {
   list($status, $user) = auth_get_status();
		switch($lang) {
		  case "ita":
			$currentlang = "ITA";
		  break;
		
		  case "eng":
			$currentlang = "ENG";
		  break;
		
		  case "fra":
			$currentlang = "FRA";
		  break;
		
		  case "esp":
			$currentlang = "ESP";
		  break;
		}

   switch($status){
     case AUTH_LOGGED:
     case AUTH_LOGEDD_IN:
        $result1 = @mysql_query("SELECT nome,stato FROM utenti WHERE id='$id_user';");
        list($username,$level) = mysql_fetch_row($result1);
		if($level=="ce")
		  setcookie('lang', 'eng', time()+ $_CONFIG['expire']);
		if($level=="VBL")  {
		  header("Location:http://www.bsvillage.com/gestione/product.php?cid=377&op=product&percorso=%2FPiscine%2FMini+Piscine+Vasche+SPA+Idromassaggio%2FVasche+Beauty+Luxury+SPA");
		  die();
		}
        switch($module) {

		  case "change_lang":
			    $newlang = $_GET['newlang'];
				setcookie('lang',$newlang, time() + $_CONFIG['expire']);
				header("Location:gestione.php");
				die();
		  break;
				  
		  case "newsletter":
		   header("Location:newsletter.php");
		   die();
		  break;

		  case "news":
		    header("Location:news.php");
		    die();
		  break;

		  case "config":
		   header("Location:config.php");
		   die();
		  break;

		  case "banner":
		   header("Location:banner.php");
		   die();
		  break;

		  case "prodotti":
		   header("Location:product_new.php");
		   die();
		  break;
		  
		  case "keywords":
		   header("Location:keywords.php");
		   die();
		  break;

		  case "content":
		   header("Location:content.php");
		   die();
		  break;
		  
		  case "user":
		   header("Location:user.php");
		   die();
		  break;

		  case "webuser":
		   header("Location:webuser.php");
		   die();
		  break;
		  
		  case "HOME":
		    $banner1 = $_FILES['banner1'];
			$link1 = $_POST['link1'];
			$banner2 = $_FILES['banner2'];
			$link2 = $_POST['link2'];
			$banner3 = $_FILES['banner3'];
			$link3 = $_POST['link3'];
			$banner4 = $_FILES['banner4'];
			$link4 = $_POST['link4'];
			$banner5 = $_FILES['banner5'];
			$link5 = $_POST['link5'];
			$banner6 = $_FILES['banner6'];
			$link6 = $_POST['link6'];
			$banner7 = $_FILES['banner7'];
			$link7 = $_POST['link7'];
			$banner8 = $_FILES['banner8'];
			$link8 = $_POST['link8'];
			$titledx = $_POST['titledx'];
			$titledx_eng = $_POST['titledx_eng'];
#################################################################################################
			if($banner1['name'] != "" || $link1!="") {
			 if($link1 != "")
			   $qry_link = ",link1='$link1'";
			 if($banner1['name'] != "")  {
		      $image1 = new Image($banner1["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner1,470,140,"banner 1");
			  $qry_banner = ",banner1='".$banner1['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner1['name']) && $banner1['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner1['name'],$path_home."/".$banner1['name']))
					 unlink($path_tmp.$banner1['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
			if($banner2['name'] != "" || $link2!="") {
			 if($link2 != "")
			   $qry_link = ",link2='$link2'";
			 if($banner2['name'] != "")  {
		      $image1 = new Image($banner2["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner2,470,140,"banner 2");
			  $qry_banner = ",banner2='".$banner2['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   //die($qry);
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner2['name']) && $banner2['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner2['name'],$path_home."/".$banner2['name']))
					 unlink($path_tmp.$banner2['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
		if($banner3['name'] != "" || $link3!="") {
			 if($link3 != "")
			   $qry_link = ",link3='$link3'";
			 if($banner3['name'] != "")  {
		      $image1 = new Image($banner3["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner3,470,140,"banner 3");
			  $qry_banner = ",banner3='".$banner3['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner3['name']) && $banner3['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner3['name'],$path_home."/".$banner3['name']))
					 unlink($path_tmp.$banner3['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
			if($banner4['name'] != "" || $link4!="") {
			 if($link4 != "")
			   $qry_link = ",link4='$link4'";
			 if($banner4['name'] != "")  {
		      $image1 = new Image($banner4["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner4,470,140,"banner 4");
			  $qry_banner = ",banner4='".$banner4['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   //die($qry);
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner4['name']) && $banner4['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner4['name'],$path_home."/".$banner4['name']))
					 unlink($path_tmp.$banner4['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
			if($banner5['name'] != "" || $link5!="") {
			 if($link5 != "")
			   $qry_link = ",link5='$link5'";
			 if($banner5['name'] != "")  {
		      $image1 = new Image($banner5["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner5,470,140,"banner 5");
			  $qry_banner = ",banner5='".$banner5['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner5['name']) && $banner5['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner5['name'],$path_home."/".$banner5['name']))
					 unlink($path_tmp.$banner5['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
			if($banner6['name'] != "" || $link6!="") {
			 if($link6 != "")
			   $qry_link = ",link6='$link6'";
			 if($banner6['name'] != "")  {
		      $image1 = new Image($banner6["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner6,470,140,"banner 6");
			  $qry_banner = ",banner6='".$banner6['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   //die($qry);
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner6['name']) && $banner6['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner6['name'],$path_home."/".$banner6['name']))
					 unlink($path_tmp.$banner6['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento."); 
			}
		if($banner7['name'] != "" || $link7!="") {
			 if($link7 != "")
			   $qry_link = ",link7='$link7'";
			 if($banner7['name'] != "")  {
		      $image1 = new Image($banner7["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner7,470,140,"banner 7");
			  $qry_banner = ",banner7='".$banner7['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner7['name']) && $banner7['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner7['name'],$path_home."/".$banner7['name']))
					 unlink($path_tmp.$banner7['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }
				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
			if($banner8['name'] != "" || $link8!="") {
			 if($link8 != "")
			   $qry_link = ",link8='$link8'";
			 if($banner8['name'] != "")  {
		      $image1 = new Image($banner8["tmp_name"]);
		      $error = $image1->CheckSizeFormat($banner8,470,140,"banner 8");
			  $qry_banner = ",banner8='".$banner8['name']."'";
			 }
			  $qry = "UPDATE home_new SET titledx=titledx $qry_banner $qry_link;"; 
			   if(mysql_query($qry))  {
         		$connect = ftp_connect($ftp_host);
		 		$login = ftp_login($connect, $ftp_username, $ftp_pwd); 
		       if(file_exists($path_tmp.$banner8['name']) && $banner8['name']!="") {
				   if(!file_exists($path_home))
					 ftp_mkdir($connect, "httpdocs/banner/home");
				   ftp_site($connect, "CHMOD 0777 "."httpdocs/banner/home");
					if(copy($path_tmp.$banner8['name'],$path_home."/".$banner8['name']))
					 unlink($path_tmp.$banner8['name']);
				   ftp_site($connect, "CHMOD 0775 "."httpdocs/banner/home");
		        }

				ftp_quit($connect);
				$content = printError("Aggiornamento avvenuto con successo!");      
			   } else
			      $content = printError("Errore nell'aggiornamento.");
			}
###################################################################################################
			if($titledx != "") {
			    $qry = "UPDATE home_new SET titledx='$titledx';";
				if(mysql_query($qry))  {
				  $content = printError("Aggiornamento avvenuto con successo!"); 
				}
			} else
			   $content = printError("Errore: non hai inserito nessun campo da aggiornare.");
			if($titledx_eng != "") {
			    $qry = "UPDATE home_new SET titledx_eng='$titledx_eng';";
				if(mysql_query($qry))  {
				  $content = printError("Aggiornamento avvenuto con successo!"); 
				}
			} else
			   $content = printError("Errore: non hai inserito nessun campo da aggiornare.");

		  break;

		  default:
		    $content = "<table width=100% cellpadding=3>
						  <tr>
						    <td class=content><br>Benvenuto nell'area di gestione moduli del tuo sito web: cliccando sui tasti in alto potrai accedere alle sezioni dinamiche,<br> che potrai gestire e modificare a tua discrezione.<br>
Per un uso corretto e sicuro dell'applicazione ti consigliamo di consultare la guida cliccando sull'apposito tasto in alto a destra; per eventuali problemi o malfunzionamenti non esitare a contattarci, i nostri tecnici sono a tua disposizione.<br><br></td>
						  </tr>
						  <tr>
						   <td width=100%>
						    <!--<table width=700 cellpadding=2 cellspacing=0 class=content>
							 <form name=home action=gestione.php method=POST enctype=\"multipart/form-data\">
							 <tr>
							  <td class=tbtit colspan=2 align=center>Aggiorna banner in home page<br>
							  Dimensioni 463 X 133 px</td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Piscine Alto:</td>
							  <td><input type=file name=banner1 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link1 size=50 value=\"\"></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Piscine Basso:</td>
							  <td><input type=file name=banner2 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link2 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Giardino Alto:</td>
							  <td><input type=file name=banner3 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link3 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Giardino Basso:</td>
							  <td><input type=file name=banner4 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link4 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Casa Alto:</td>
							  <td><input type=file name=banner5 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link5 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Casa Basso:</td>
							  <td><input type=file name=banner6 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link6 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Sport Alto:</td>
							  <td><input type=file name=banner7 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link7 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Banner Sport Basso:</td>
							  <td><input type=file name=banner8 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Link:</td>
							  <td><input type=text name=link8 size=50></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Titolo banner a destra:</td>
							  <td><input type=text name=titledx size=50 value=\"".$_CONFIG['titledx']."\"></td>
							 </tr>
							 <tr>
							  <td width=100 align=right>Titolo banner a destra inglese:</td>
							  <td><input type=text name=titledx_eng size=50 value=\"".$_CONFIG['titledx_eng']."\"></td>
							 </tr>
							 <tr>
							  <td colspan=2 align=center><input type=hidden name=module value=HOME>
							  <input type=submit value=Aggiorna>
							  </td>
							 </tr>
							 </form>
							</table>-->
						   </td>
						  </tr>
						</table>";
			$menusx = "";
		  break;
		}
?><html><!-- InstanceBegin template="/Templates/moduli.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Gestione Moduli dinamici</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="style/style.css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
<!--
<?=$javascript?>

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  var dis;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) {
	   obj=obj.style; 
	   if(v == 'show')  {
	     v = 'visible';
		 dis = 'block';
	   }
	   if(v == 'hide')  {
	     v = 'hidden';
		 dis = 'none';	 
	   }
	 }  
    obj.visibility = v; 
	obj.display = dis;
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('imgs/icons/pag_web-b.gif','imgs/icons/info_utente-b.gif','imgs/icons/prodotti-b.gif','imgs/icons/newsletter-b.gif','imgs/icons/news-b.gif','imgs/icons/gest_banner-b.gif','imgs/icons/utenti-b.gif','imgs/icons/configurazione-b.gif','imgs/icons/kw-b.gif'); <?=$onload?>">
<!-- ImageReady Slices (gestione.psd - Slices: 02, 03, 04, 06, 07, 08, 09, 10, 11, 12) -->
<!-- End ImageReady Slices -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="40" height="177" background="imgs/bkgSx.gif">&nbsp;</td>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="552" background="imgs/gestione_02.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="360"><img src="imgs/spacer20.gif" width="360" height="73"></td>
            <td><table width="100%" height="73" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="5"><img src="imgs/spacer20.gif" width="45" height="5"></td>
              </tr>
              <tr>
                <td align="left" valign="middle" class="tit01"><!-- InstanceBeginEditable name="user" --><?=$username?><!-- InstanceEndEditable --></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        <td background="imgs/gestione_03.gif">&nbsp;</td>
        <td width="221"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="imgs/gestione_04.gif" width="221" height="17" alt=""></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="57"><a href="gestione.php?logout=1"><img src="imgs/gestione_06.gif" alt="Logout" width="57" height="51" border="0"></a></td>
                <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><a href="mailto:info@media-tek.it"><img src="imgs/gestione_07.gif" alt="" width="164" height="25" border="0"></a></td>
                  </tr>
                  <tr>
                    <td><a href="#"><img src="imgs/gestione_08.gif" alt="" width="164" height="26" border="0"></a></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><img src="imgs/gestione_09.gif" width="221" height="5" alt=""></td>
          </tr>
        </table></td>
      </tr>
    </table>
      <table width="100%" height="104" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td width="678" background="imgs/gestione_10.gif">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="203">
						<table width="203" height="104" border="0" cellpadding="0"
							cellspacing="0">
							<tr>
								<td><img src="imgs/spacer20.gif" width="203" height="65"></td>
							</tr>
							<tr>
								<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="45"><img src="imgs/spacer20.gif" width="45"
											height="39"></td>
										<td>
										<table width="100%" height="39" border="0" cellpadding="5"
											cellspacing="0">
											<tr>
												<td align="left" valign="middle" class="module"><?=$module?>
												</td>
											</tr>
										</table>
										</td>
									</tr>
								</table>
								</td>
							</tr>
						</table>
						</td>
						<td>
						<table width="475" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="50"><img src="imgs/spacer20.gif" width="50"
									height="104" alt=""></td>
								<td align="left" valign="bottom"><? if($level!="VBL")  { ?>
								<table border="0" cellspacing="0" cellpadding="2">
									<tr>
									<?
									if($level=="admin")  {
										?>
										<td width="58"><a href="gestione.php?module=content"
											onMouseOut="MM_swapImgRestore()"
											onMouseOver="MM_swapImage('pages','','imgs/icons/pag_web-b.gif',1)"><img
											src="imgs/icons/pag_web.gif" alt="Pagine web" name="pages"
											width="58" height="69" border="0"></a></td>
										<td width="58"><a href="gestione.php?module=newsletter"
											onMouseOut="MM_swapImgRestore()"
											onMouseOver="MM_swapImage('Newsletter','','imgs/icons/newsletter-b.gif',1)"><img
											src="imgs/icons/newsletter.gif" alt="Newsletter"
											name="Newsletter" width="58" height="69" border="0"></a></td>
											<?
									}
									?>
										<td width="58"><a href="gestione.php?module=banner"
											onMouseOut="MM_swapImgRestore()"
											onMouseOver="MM_swapImage('banner','','imgs/icons/gest_banner-b.gif',1)"><img
											src="imgs/icons/gest_banner.gif" alt="Gestione Banner"
											name="banner" width="58" height="69" border="0"></a></td>
										<td width="58"><a href="gestione.php?module=prodotti"><img
											src="imgs/icons/prodotti.gif" alt="Pagine Web" name="pagine"
											width="58" height="69" border="0" id="pagine"
											onMouseOver="MM_swapImage('pagine','','imgs/icons/prodotti-b.gif',1)"
											onMouseOut="MM_swapImgRestore()"></a></td>
									</tr>
								</table>
								<? } ?></td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
				<td valign="bottom" background="imgs/gestione_11.gif">
				<table cellpadding="2" cellspacing="0">
					<tr>
						<td width="58"><a href="gestione.php?module=webuser"
							onMouseOut="MM_swapImgRestore()"
							onMouseOver="MM_swapImage('webutente','','imgs/icons/utenti-b.gif',1)"><img
							src="imgs/icons/utenti.gif" name="webutente" width="58"
							height="69" border="0"></a></td>
							<?
				if($level=="admin")  {
					?>
						<td width="58"><a href="gestione.php?module=user"
							onMouseOut="MM_swapImgRestore()"
							onMouseOver="MM_swapImage('Utente','','imgs/icons/info_utente-b.gif',1)"><img
							src="imgs/icons/info_utente.gif" name="Utente" width="58"
							height="69" border="0"></a></td>
						
				<?
				} else {
					?>&nbsp;<?
				}
				?>
						<td width="20" valign="middle">
						</td>
					</tr>
				</table>
				</td>
				<td width="95"><img src="imgs/gestione_12.gif" width="95"
					height="104" alt=""></td>
			</tr>
		</table>
    </td>
    <td width="40" background="imgs/bkgDx.gif">&nbsp;</td>
  </tr>
  <tr>
    <td background="imgs/bkgSx.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F6F6F6"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="203" align="left" valign="top" bgcolor="#DFDFDF" class="menusx"><!-- InstanceBeginEditable name="menuSx" --><?=$menuSx?><!-- InstanceEndEditable --></td>
        <td align="left" valign="top" bgcolor="#EFEFEF" class="content"><!-- InstanceBeginEditable name="content" --><?=$content?><!-- InstanceEndEditable --></td>
      </tr>
    </table>
      <table width="100%" height="50" border="0" cellpadding="5" cellspacing="0">
        <tr>
          <td background="imgs/gestione_03.gif" bgcolor="#F6F6F6" class="copy"><p>2006&copy; Gestione moduli dinamici - release 1.2 - Powered by Media-tek </p></td>
        </tr>
      </table></td>
    <td background="imgs/bkgDx.gif">&nbsp;</td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
<?
	 break;
		
     case AUTH_NOT_LOGGED:
	  header("Location:index.html");
	  die();
	 break;
	}	 
  } 
 }	 
}		
?>